#ifndef STATUSSERVER_CLIENT_RPC_H
#define STATUSSERVER_CLIENT_RPC_H

#include "SingleClass.h"
#include <grpc++/grpc++.h>
#include "../rpc_src/message.grpc.pb.h"
#include "../rpc_src/message.pb.h"
#include <thread>

//发送心跳的间隔为140s
#define HEART_BEAT_GAP 120

class statusServer_client_rpc:public SingleClass<statusServer_client_rpc>{

public:
    //各种rpc服务调用
    bool register_chat_server();
    bool check_token(std::string &email,std::string & token);
    bool delete_chat_server();
    bool heart_beat();  //发送心跳包
    std::string get_forward_target(const std::string &email);  //获取目标用户所在chat_server  
private:
    friend class SingleClass<statusServer_client_rpc>;
    statusServer_client_rpc();
    std::shared_ptr<grpc::Channel> _channel;
    std::unique_ptr<message::statusServer::Stub> _stub;
    std::thread heart_beat_thread;  //心跳发送线程
    
};


#endif